package com.tm.mholmu.db;

import java.util.ArrayList;
import java.util.List;

import com.example.mholmu.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class SkillBaseAdapter extends BaseAdapter {
	Outfits sf;
	Context c;
	List<SkillBar> lsb = new ArrayList<SkillBar>();

	public SkillBaseAdapter(Outfits sf, Context c) {
		super();
		this.sf = sf;
		this.c = c;
		lsb = sf.lsb;
	}

	@Override
	public int getCount() {
		// TODO 自动生成的方法存根
		return sf.i.length;
	}

	@Override
	public Object getItem(int arg0) {
		// TODO 自动生成的方法存根
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO 自动生成的方法存根
		return 0;
	}

	@Override
	public View getView(int arg0, View v, ViewGroup arg2) {
		// TODO 自动生成的方法存根
		final ViewHolder holder;
		if (v == null) {
			holder = new ViewHolder();
			v=View.inflate(c, R.layout.skill_list,
					null);
			holder.skill_body = (TextView) v.findViewById(R.id.skill_body);
			holder.skill_foot =(TextView) v.findViewById(R.id.skill_foot);
			holder.skill_hand = (TextView) v.findViewById(R.id.skill_hand);
			holder.skill_head =(TextView) v.findViewById(R.id.skill_head);
			holder.skill_name = (TextView) v.findViewById(R.id.skill_name);
			holder.skill_stone = (TextView) v.findViewById(R.id.skill_stone);
			holder.skill_sum = (TextView) v.findViewById(R.id.skill_sum);
			holder.skill_waist =(TextView) v.findViewById(R.id.skill_waist);
			v.setTag(holder);
		} else {
			holder = (ViewHolder) v.getTag();
		}
		holder.skill_body.setText(""+lsb.get(arg0).body);
		holder.skill_foot.setText(""+lsb.get(arg0).foot);
		holder.skill_hand.setText(""+lsb.get(arg0).hand);
		holder.skill_head.setText(""+lsb.get(arg0).head);
		holder.skill_name.setText(""+lsb.get(arg0).name);
		holder.skill_stone.setText(""+lsb.get(arg0).stone);
		holder.skill_sum.setText(""+lsb.get(arg0).getsun());
		holder.skill_waist.setText(""+lsb.get(arg0).waist);
		holder.skill_stone.setText(""+lsb.get(arg0).stone);
		return v;
	}

	/* Item的数据结构 */
	public class ViewHolder {
		TextView skill_name;
		TextView skill_head;
		TextView skill_body;
		TextView skill_hand;
		TextView skill_waist;
		TextView skill_foot;
		TextView skill_stone;
		TextView skill_sum;

	}

}
